<?php
namespace ctrl\demo;
use L;
use Sdk\Fourstar\callFourStarApiUtil;

class fourstar
{
    //获取仓库列表  http://ec.com/?c=demo_fourstar&a=warehouseList
    public static function warehouseList()
    {
        $method = 'GetStockList';
        $data = [];
        $result = (new callFourStarApiUtil())->callApi($method, $data);
        echo '<pre />';
        print_r($result);
    }


    //获取拉取四叶星的库存列表 http://ec.com/?c=demo_fourstar&a=pull
    public static function pull()
    {
        \serv\task\warehouse\fourstar::pull();
    }

    //获取拉取四叶星的库存列表 http://ec.com/?c=demo_fourstar&a=pullQueue
    public static function pullQueue()
    {
        $string = '{"warehouse_id":"173","warehouse_code":"22"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\fourstar::pull($data);
        var_dump($result);
    }


    //更新或锁 //http://ec.com/?c=demo_fourstar&a=stock
    public static function stock()
    {
        $string = '{"SKU":"A0000209B3J-KDA-KH1","GoodsCode":"A0000209B3J-KDA-KH1","AvailableQty":0,"StockQty":0,"UsedQty":0,"StockUnitNo":"A-01-001","StockID":22,"Style":1,"warehouse_id":"173"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\fourstar::check($data);
        var_dump($result);
    }
}


